package com.xidian.zhiancloud.controller.lz.hiddeninvestigation.hiddeninvestigationbasic;

import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.model.HiddenDangerTypeBasics;
import com.xidian.zhiancloud.service.lz.hiddeninvestigation.hiddeninvestigationbasic.HiddenInvestigationTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 隐患排查类型设置
 */
@RestController
@RequestMapping("/hiddenInvestigation")
public class HiddenInvestigationTypeController {

    @Autowired
    private HiddenInvestigationTypeService hiddenInvestigationTypeService;

    @GetMapping("/getList")
    public ResultDTO getList(@RequestParam(value="type",required = false) String type,
                             @RequestParam(value = "current", required = true) int current,
                             @RequestParam(value = "size", required = true) int size) {
        return ResultDTO.successOf(hiddenInvestigationTypeService.getList(type,current,size), GeneralResponseEnums.SUCCESS);
    }
    @PostMapping("/insert")
    public ResultDTO insert(@RequestBody HiddenDangerTypeBasics hiddenDangerTypeBasics) {
        hiddenInvestigationTypeService.insert(hiddenDangerTypeBasics);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    @PostMapping("/update")
    public ResultDTO update(@RequestBody HiddenDangerTypeBasics hiddenDangerTypeBasics) {
        hiddenInvestigationTypeService.update(hiddenDangerTypeBasics);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    @PostMapping("/delete")
    public ResultDTO delete(@RequestBody HiddenDangerTypeBasics hiddenDangerTypeBasics) {
        hiddenInvestigationTypeService.delete(hiddenDangerTypeBasics);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    @DeleteMapping("/deleteByIds")
    public ResultDTO deleteByIds(Long[] ids) {
        hiddenInvestigationTypeService.deleteByIds(ids);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
}
